package com.example.bootintegration.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.reflect.Field;

/**
 * @author Quintoy
 * @date 10/23/23
 */
@Service
public class ServiceA {

    @Autowired
    private ServiceB serviceB;

    // public ServiceA(ServiceB serviceB) {
    //     this.serviceB = serviceB;
    // }


    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        ServiceA a = new ServiceA();
        ServiceB b = new ServiceB(a);
        Field serviceB = ServiceA.class.getDeclaredField("serviceB");
        serviceB.setAccessible(true);
        serviceB.set(a, b);
    }
}
